<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
 <?php
        // put your code here
 $zhuti="default1";
 if(isset($_COOKIE["zhuti"])){
     $zhuti=$_COOKIE["zhuti"];
 }
 echo "<br/>count(\$_POST)的长度: ".count($_POST)."<br/>";
 if(count($_POST)){
//     echo "<br/>count(\$_POST)的值: "."<br/>";
//     foreach($_POST as $k=>$v){
//         echo $k."-->".$v;
//     }
     $zhuti=$_POST["zhuti"];
     setcookie("zhuti",$_POST["zhuti"],time()+3600*24*30);
 }
 ?>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            .redl{
                background-color: red;
                color:yellow;
            }
            .bluel{
                background-color: blue;
                color:gray;
            }
            .default1{
                color:#005678;
            }
        </style>
    </head>
    <body class="<?php echo $zhuti;?>">
        <form action="cc1.php" method="post">
            主题:<select name="zhuti">
                <option value="bluel">蓝色</option>
                <option value="redl">红色</option>
            </select>
            <br/>
            <input type="submit" value="确定"/>
            <p>
                cookie的使用案例
            </p>
        </form>   
        <?php
        // put your code here
        ?>
    </body>
</html>
